//package com.designtest;
//
//
//import org.springframework.util.CollectionUtils;
//
//import java.util.ArrayList;
//import java.util.Collections;
//import java.util.List;
//
///**
// * 复杂逻辑的校验可以通过这种方式
// */
//public class Check {
//    public static void main(String[] args) {
//        Checker checker = Check.build()
//                .checkDistributeInfoError(inv, app, onlineApp, appKeyInfo.getOperatorType(), isInDiscoverWhitelist)
//                .checkImageInfo(inv, app, appKeyInfo)
//                .checkAppQualificationCertificateInfo(inv, app, appKeyInfo,deployType, developerId, initAuthApp.getCooperateType())
//                .checkAppBaseInfo(inv, app, appKeyInfo, onlineApp).checkHasVerified(app, draft.getHasVerified())
//                .checkLanguages(inv, app, onlineApp).checkContactInfo(app)
//                .checkApkInfo(app, appKeyInfo, deployType, draft.getHasUploadApk())
//                .checkClaimBeianInfo(app, appKeyInfo);
//
//        List<AppPublishMergeValidError> errors = checker.check();
//        if(!CollectionUtils.isEmpty(errors)){
//            return;
//        }
//    }
//
//    public static class Checker {
//        private List<AppPublishMergeValidError> errors = new ArrayList<>();
//        public Checker checkDistributeInfoError(Invocation inv, AppData appData, AppData onlineApp, int operatorType, boolean isInDiscoverWhitelist) {
//            errors.addAll(CheckFormParam.checkDistributeInfoError(inv, appData, onlineApp, operatorType, isInDiscoverWhitelist));
//            return this;
//        }
//        public List<AppPublishMergeValidError> check() {
//            errors.removeAll(Collections.singletonList(null));
//            return errors;
//        }
//
//        public Checker checkImageInfo(Invocation inv, AppData app, AppKeyInfo appKeyInfo) {
//            errors.addAll(CheckFormParam.checkImageInfo(inv, app, appKeyInfo));
//            return  this;
//        }
//
//        public Checker checkAppQualificationCertificateInfo(Invocation inv, AppData app, AppKeyInfo appKeyInfo, DeployType deployType, Long developerId, int cooperateType) {
//            errors.addAll(CheckFormParam.checkAppQualificationCertificateInfo(inv, app, appKeyInfo, deployType, developerId, cooperateType));
//            return  this;
//        }
//
//        public Checker checkHasVerified(AppData app, boolean hasVerified) {
//            errors.addAll(CheckFormParam.checkHasVerified(app, hasVerified));
//            return this;
//        }
//
//        public Checker checkAppBaseInfo(Invocation inv, AppData app, AppKeyInfo appKeyInfo, AppData onlineApp) {
//            errors.addAll(CheckFormParam.checkAppBaseInfo(inv, app, appKeyInfo, onlineApp));
//            return this;
//        }
//
//        public Checker checkLanguages(Invocation inv, AppData app, AppData onlineApp) {
//            errors.addAll(CheckFormParam.checkLanguages(inv, app, onlineApp));
//            return this;
//        }
//
//        public Checker checkContactInfo(AppData app) {
//            errors.addAll(CheckFormParam.checkContactInfo(app));
//            return this;
//        }
//
//        public Checker checkApkInfo(AppData app, AppKeyInfo appKeyInfo, DeployType deployType, boolean hasUploadApk) {
//            errors.addAll(CheckFormParam.checkApkInfo(app, deployType, appKeyInfo));
//            return this;
//        }
//        public Checker checkClaimBeianInfo(AppData app, AppKeyInfo appKeyInfo) {
//            if (appKeyInfo.getNamespaceValue() != NamespaceName.DEFAULT.getValue() && appKeyInfo.getNamespaceValue() != NamespaceName.EV.getValue()) {
//                return this;
//            }
//            errors.addAll(CheckFormParam.checkClaimBeianInfo(app, appKeyInfo));
//            return this;
//        }
//
//        public Checker checkQualificationUploadStatus(AppData appData) {
//            errors.addAll(CheckFormParam.checkQualificationUploadStatus(appData));
//            return this;
//        }
//
//    }
//
//    public static  Checker build(){
//        return  new Checker();
//    }
//}
